﻿using System;
using AppTouchScreen.Model;

namespace AppTouchScreen.Helper
{
    /// <summary>
    /// Store and change a state (StoreState) of the App
    /// </summary>
    public class StoreHelper
    {
        public delegate void ChangeStoreStateEventHandler(StoreState state);

        public event ChangeStoreStateEventHandler ChangeStoreState;

        private static StoreHelper _instance = null;

        public static StoreHelper Instance
        {
            get
            {
                if (_instance == null)
                {
                    _instance = new StoreHelper();
                }
                return _instance;
            }
        }

        private StoreHelper(){}

        private StoreState _storeState = StoreState.View;

        public StoreState StoreState
        {
            get { return _storeState; }
            set 
            {
                _storeState = value;
                if (ChangeStoreState != null)
                {
                    ChangeStoreState(value);
                }
            }
        }
    }
}
